package com.dnjn.happiness.system.api;

import com.dnjn.happiness.common.core.constant.SecurityConstants;
import com.dnjn.happiness.common.core.constant.ServiceNameConstants;
import com.dnjn.happiness.common.core.domain.R;
import com.dnjn.happiness.common.core.model.TeamVo;
import com.dnjn.happiness.system.api.domain.SysTeam;
import com.dnjn.happiness.system.api.factory.RemoteTeamFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;


@FeignClient(contextId = "remoteTeamService",value = ServiceNameConstants.SYSTEM_SERVICE,fallbackFactory = RemoteTeamFallbackFactory.class)
public interface RemoteTeamService {

    @GetMapping("/admin/sysTeam/updateAppraiseTime/{userId}")
    void updateAppraiseTime(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/admin/sysTeam/getChildList/{teamId}")
    R<List<Long>> getChildList(@PathVariable("teamId") Long teamId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PutMapping("/admin/sysTeam/updateTeamCheckTimeByUserId/{userId}")
    void updateTeamCheckTimeByUserId(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/admin/sysTeam/getMangerUpOne/{userId}")
    R<SysTeam> getMangerUpOne(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/admin/sysTeam/getSubordinate/{userId}")
    R<List<SysTeam>> getSubordinate(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/admin/sysTeam/getManager/{userId}")
    R<List<SysTeam>> getManager(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/admin/sysTeam/getLeaderList")
    R<List<SysTeam>> getLeaderList(@RequestBody List<SysTeam> sysTeams, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/admin/sysTeam/getEmployees")
    R<List<SysTeam>> getEmployees(@RequestBody List<SysTeam> sysTeams, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    @GetMapping("/admin/sysTeam/getLeaderListBydeptId/{deptId}")
    R<List<SysTeam>> getLeaderListBydeptId(@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/admin/sysTeam/getParentInfoByUserId/{userId}")
    R<SysTeam> getParentInfoByUserId(@PathVariable("userId") Long userId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/admin/sysTeam/getInfoById/{userId}")
    R<SysTeam> getInfoById(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/admin/sysTeam/queryInfoByTeamId/{teamId}")
    R<SysTeam> queryInfoByTeamId(@PathVariable("teamId") Long teamId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
